/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80027
 Source Host           : localhost:3306
 Source Schema         : db_shopping

 Target Server Type    : MySQL
 Target Server Version : 80027
 File Encoding         : 65001

 Date: 15/08/2022 15:20:55
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for tb_address
-- ----------------------------
DROP TABLE IF EXISTS `tb_address`;
CREATE TABLE `tb_address` (
  `id` int NOT NULL AUTO_INCREMENT,
  `detail` text CHARACTER SET utf8 COLLATE utf8_general_ci,
  `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `uid` int NOT NULL,
  `level` int DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `fk_address_id` (`uid`) USING BTREE,
  CONSTRAINT `fk_address_id` FOREIGN KEY (`uid`) REFERENCES `tb_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_address
-- ----------------------------
BEGIN;
INSERT INTO `tb_address` VALUES (2, '北京市:北京市市辖区:东城区:宝盛北里西区天丰利商城四层 千锋教育', '老王', '1567890890822', 3, 1);
INSERT INTO `tb_address` VALUES (3, '北京市海淀区3', '老王', '136110803022', 3, 0);
INSERT INTO `tb_address` VALUES (4, '22223', '张', '112', 6, 0);
INSERT INTO `tb_address` VALUES (6, '辽宁省朝阳市凌源', '张', '15678908908', 4, 0);
COMMIT;

-- ----------------------------
-- Table structure for tb_cart
-- ----------------------------
DROP TABLE IF EXISTS `tb_cart`;
CREATE TABLE `tb_cart` (
  `id` int NOT NULL,
  `pid` int NOT NULL DEFAULT '0',
  `Num` int DEFAULT NULL,
  `money` int DEFAULT NULL,
  PRIMARY KEY (`id`,`pid`) USING BTREE,
  KEY `fk_cart_pid` (`pid`) USING BTREE,
  CONSTRAINT `fk_cart_id` FOREIGN KEY (`id`) REFERENCES `tb_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_cart_pid` FOREIGN KEY (`pid`) REFERENCES `tb_goods_kz` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_cart
-- ----------------------------
BEGIN;
INSERT INTO `tb_cart` VALUES (3, 1, 1, NULL);
COMMIT;

-- ----------------------------
-- Table structure for tb_goods
-- ----------------------------
DROP TABLE IF EXISTS `tb_goods`;
CREATE TABLE `tb_goods` (
  `id` int NOT NULL AUTO_INCREMENT,
  `kzid` int NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_goods
-- ----------------------------
BEGIN;
INSERT INTO `tb_goods` VALUES (1, 1);
INSERT INTO `tb_goods` VALUES (2, 2);
INSERT INTO `tb_goods` VALUES (3, 3);
INSERT INTO `tb_goods` VALUES (4, 4);
INSERT INTO `tb_goods` VALUES (5, 5);
INSERT INTO `tb_goods` VALUES (6, 6);
INSERT INTO `tb_goods` VALUES (7, 7);
INSERT INTO `tb_goods` VALUES (8, 8);
COMMIT;

-- ----------------------------
-- Table structure for tb_goods_kz
-- ----------------------------
DROP TABLE IF EXISTS `tb_goods_kz`;
CREATE TABLE `tb_goods_kz` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `pubdate` date DEFAULT NULL,
  `picture` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `price` int NOT NULL,
  `star` tinyint NOT NULL DEFAULT '0',
  `intro` text CHARACTER SET utf8 COLLATE utf8_general_ci,
  `typeid` int NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `fk_typeid` (`typeid`) USING BTREE,
  CONSTRAINT `fk_typeid` FOREIGN KEY (`typeid`) REFERENCES `tb_goods_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_goods_kz
-- ----------------------------
BEGIN;
INSERT INTO `tb_goods_kz` VALUES (1, 'java模式', '2017-09-12', '8\\7\\8bba858c-79da-4cdc-a974-eb4526d7408b_696673-1_w.jpg', 1, 5, '第一', 1);
INSERT INTO `tb_goods_kz` VALUES (2, 'java编程思想', '2017-09-14', '8\\7\\8bba858c-79da-4cdc-a974-eb4526d7408b_696673-1_w.jpg', 23, 5, '第二本', 1);
INSERT INTO `tb_goods_kz` VALUES (3, 'html5', '2017-09-07', '8\\7\\8b607da8e9-8421-47c2-bc61-424c22c50697_696673-1_w.jpg', 78, 4, '第一本html\r\n实例二\r\n\r\n     这次要介绍的就没那么简单了，这个悬停弹出框的效果比第一个实例要复杂很多。弹出框弹出的效果是一样的，不一样的是弹出框的内容，这次的弹出框中不仅要有提示，还要有相应的信息，链接等。小编所做的效果是在弹出框中添加了图片，然后有相应的链接，在点击之后可以跳转到不同的页面。', 1);
INSERT INTO `tb_goods_kz` VALUES (4, '安卓', '2017-09-02', 'b\\8\\46e944eb-3589-4dc3-aafa-24227ff0323c_', 89, 3, '安卓第一本书是从这里开始的', 1);
INSERT INTO `tb_goods_kz` VALUES (5, '小米6', '2018-01-24', 'd\\a\\3b673ed6-9dd9-4f34-8920-c4da39af94fd_liebiao_xiaomi6.jpg', 2499, 3, '变焦双摄，4 轴防抖 / 骁龙835 旗舰处理器，6GB 大内存，最大可选128GB 闪存 / 5.15\" 护眼屏 / 四曲面玻璃/陶瓷机身', 2);
INSERT INTO `tb_goods_kz` VALUES (6, '小米7mini', '2018-01-10', '8\\5\\86c72bfa-67c2-4ab1-97ec-a82d6b2168d0_liebiao_xiaomi6.jpg', 1, 2, '', 2);
INSERT INTO `tb_goods_kz` VALUES (7, 'admin', '2018-01-20', '7\\1\\daf26636-d382-402c-9ac0-5e4f39aa5299_liebiao_xiaomi6.jpg', 11, 4, '', 5);
INSERT INTO `tb_goods_kz` VALUES (8, '小米MIX2', '2018-01-24', 'f\\0\\c5da94db-0d2e-42df-a4ab-2610e9b02df0_liebiao_xiaomimix.jpg', 1588, 3, '5.99\" 超大屏幕\r\n机身却比 5.5\" 传统手机还小\r\n\r\n5.99\"，你很难找到比它屏幕大，但是尺寸却比它小的手机。\r\n这源于不断进化的全面屏科技，带来更窄的底边、更小的相机、隐藏的距离传感器……\r\n最终将 5.99\" 大屏装进了比 5.5\" 传统手机还小的机身内，握感绝佳。', 2);
COMMIT;

-- ----------------------------
-- Table structure for tb_goods_type
-- ----------------------------
DROP TABLE IF EXISTS `tb_goods_type`;
CREATE TABLE `tb_goods_type` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `level` int DEFAULT NULL,
  `Parent` int DEFAULT NULL,
  `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_goods_type
-- ----------------------------
BEGIN;
INSERT INTO `tb_goods_type` VALUES (1, '计算机', 1, 0, '1');
INSERT INTO `tb_goods_type` VALUES (2, '小米手机', 1, 0, '1');
INSERT INTO `tb_goods_type` VALUES (3, '笔记本', 1, 0, '1');
INSERT INTO `tb_goods_type` VALUES (4, '电视盒子', 1, 0, '1');
INSERT INTO `tb_goods_type` VALUES (5, '智能家电', 1, 0, '1');
INSERT INTO `tb_goods_type` VALUES (6, '其他', 2, 1, '1');
INSERT INTO `tb_goods_type` VALUES (7, '平衡车', 0, 6, '1');
INSERT INTO `tb_goods_type` VALUES (8, '辅导室', 3, 6, '1');
INSERT INTO `tb_goods_type` VALUES (9, '辅导室222', 4, 8, '1');
COMMIT;

-- ----------------------------
-- Table structure for tb_order
-- ----------------------------
DROP TABLE IF EXISTS `tb_order`;
CREATE TABLE `tb_order` (
  `id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `uid` int DEFAULT NULL,
  `money` int DEFAULT NULL,
  `status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `time` datetime DEFAULT NULL,
  `aid` int DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `fk_order_uid` (`uid`) USING BTREE,
  KEY `fk_order_aid` (`aid`) USING BTREE,
  CONSTRAINT `fk_order_aid` FOREIGN KEY (`aid`) REFERENCES `tb_address` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_order_uid` FOREIGN KEY (`uid`) REFERENCES `tb_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_order
-- ----------------------------
BEGIN;
INSERT INTO `tb_order` VALUES ('72e364bebbc749f8b1fa8ec16c60eca5', 3, 1, '1', '2022-08-15 14:59:04', 2);
INSERT INTO `tb_order` VALUES ('8718d9e33e37429aa7916136f77a89b1', 3, 1, '2', '2022-02-22 21:05:25', 2);
COMMIT;

-- ----------------------------
-- Table structure for tb_orderdetail
-- ----------------------------
DROP TABLE IF EXISTS `tb_orderdetail`;
CREATE TABLE `tb_orderdetail` (
  `id` int NOT NULL AUTO_INCREMENT,
  `Oid` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `pid` int DEFAULT NULL,
  `num` int DEFAULT NULL,
  `Money` int DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `fk_order_pid` (`pid`) USING BTREE,
  KEY `fk_order_id` (`Oid`) USING BTREE,
  CONSTRAINT `fk_order_id` FOREIGN KEY (`Oid`) REFERENCES `tb_order` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_order_pid` FOREIGN KEY (`pid`) REFERENCES `tb_goods_kz` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_orderdetail
-- ----------------------------
BEGIN;
INSERT INTO `tb_orderdetail` VALUES (5, '8718d9e33e37429aa7916136f77a89b1', 1, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for tb_user
-- ----------------------------
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `gender` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `flag` int DEFAULT NULL,
  `role` int DEFAULT NULL,
  `code` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `regdate` datetime DEFAULT NULL COMMENT '注册时间',
  `updatetime` datetime DEFAULT NULL COMMENT '封信时间',
  `currentlogintime` datetime DEFAULT NULL COMMENT '本次登录时间',
  `lastlogintime` datetime DEFAULT NULL COMMENT '上次登录时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of tb_user
-- ----------------------------
BEGIN;
INSERT INTO `tb_user` VALUES (3, 'admin', 'e10adc3949ba59abbe56e057f20f883e', '2407359193@qq.com', '女', 1, 0, '20170912202221249354', NULL, NULL, NULL, NULL);
INSERT INTO `tb_user` VALUES (4, 'lee', 'e10adc3949ba59abbe56e057f20f883e', '2407359193@qq.com', '男', 1, 1, '2017091221312740330d', NULL, NULL, NULL, NULL);
INSERT INTO `tb_user` VALUES (5, 'andy', '81dc9bdb52d04dc20036dbd8313ed055', '2407359193@qq.com', '女', 2, 1, '201709122331221743af', NULL, NULL, NULL, NULL);
INSERT INTO `tb_user` VALUES (6, 'amin', 'e10adc3949ba59abbe56e057f20f883e', '2407359193@qq.com', '女', 1, 1, '2018012218370268135d', NULL, NULL, NULL, NULL);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
